﻿<Window x:Class="GenericDataStorageDemo.WPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Generic Data Storage Demo" SizeToContent="WidthAndHeight">
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        
        <Grid Grid.Row="0" Margin="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120" />
                <ColumnDefinition Width="120" />
                <ColumnDefinition Width="120" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <TextBlock Grid.Column="0" Grid.Row="0" Text="Id:" Margin="2" HorizontalAlignment="Right" VerticalAlignment="Center" />
            <TextBlock Grid.Column="0" Grid.Row="1" Text="Name:" Margin="2" HorizontalAlignment="Right" VerticalAlignment="Center" />
            <TextBox Name="idTextBox" Grid.Column="1" Grid.Row="0" Margin="2" />
            <TextBox Name="nameTextBox" Grid.Column="1" Grid.Row="1" Margin="2" />
            <Button Grid.Column="1" Grid.Row="2" Content="Save" Margin="2" Click="SaveButton_Click" />
            <Button Grid.Column="2" Grid.Row="0" Content="Find" Margin="2" Click="FindButton_Click" />
        </Grid>

        <Border Grid.Row="1" Background="#666666" Height="1" Margin="5,10,5,10" />
        
        <Grid Grid.Row="2">
            <ListView ItemsSource="{Binding Users}" Margin="5" Height="150" Width="400" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Visible">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="120" />
                                <ColumnDefinition Width="120" />
                                <ColumnDefinition Width="120" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="{Binding Id}" Margin="2" />
                            <TextBlock Grid.Column="1" Text="{Binding Name}" Margin="2" />
                            <Button Grid.Column="2" Content="Delete" Margin="2" Click="DeleteButton_Click" />
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </Grid>
        
    </Grid>
    
</Window>
